import base64
import subprocess 
from functools import partial
from typing import dataclass_transform
subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") #TypeError: Cannot read properties of undefined (reading 'apply')
import execjs
import requests

cookies = {
    'Hm_lvt_b966fe201514832da03dcf6cbf25b8a2': '1745654551',
    'HMACCOUNT': 'F3CFAC671CCD2E41',
    'Hm_lpvt_b966fe201514832da03dcf6cbf25b8a2': '1745654567',
    'ssxmod_itna': 'mqmx0DuQ9D9DzrDU7mm5YK0=D8DcnBZcAhc7lBDGTKDs7zNDSxGKidDqxBnw=v3fqel70wvFermrwx=XQiSawxq860EhFAGDB3DEx0=eHY0gxGGnxBYDQxAYDGDDP1Dj4ibDYS/ODjDytZBqtcDAQDQ4GyDitDKLiBDi3DA4DjGwwIQDt9DYQDGqDSblT4xD3Df8tqDDNqzcD4WgDDbxUll824kQWeRqqQGqDMD7tD/RqwyluwT9GVRuHGE6PcbQrDtqD9Glt08W+g4CXuA=4t8Ej54+pw0DxQWOGQrAxuBiFQmPxa+hD/vprKuP0iK+x3QGE0Gx3Y0+DxeD',
    'ssxmod_itna2': 'mqmx0DuQ9D9DzrDU7mm5YK0=D8DcnBZcAhc7lBDGqikjC=DlEr4j4K+Kb=5K5+oQ2QWk5KQe+xApxPd3Wg28eYlCOTaf387o5=yff4hQp=fEQy9p7YfmDI+zFqNfcAMf+Gu86sxUmfkB0UqeW6AQT3eB+E8lwrNfoRx9ki+BGLfYbh7GwA=muu+WoIYymn1fMw7bPUPHuLut+wlt3nxrucmibFuzca5Tbo6YiLHqxQocimtwe=sg8juD32bS0L73AKmNIY1Wd=6V1vttCr6lAfz77OF=df5wxTOw5Au8SNEfuqeFk5EspK3r=n4p8iViTa3uhY0HKe4iBxvRW39bWhuiiz7n4tTqNm58bWCPwYiYuw0Qu5YRxKiHUrgzP84Fre9GzYw0cVYgOQKW8az9wQkWQaAXeI4yx5YpbCILYwFWR=HuMQKosvNQHLG9bmFWf3HkqX/qltwXiYFwSh7T5NmFCSb+eiHueOOQQwsb+F/SHY0liG348Cg0qH8m0G39mC++4o0+mWwdpjmWIBxzb5GBrzWjr0vK0QCeuCNCr8O14R=QG+arrL4xYxHpP/4foad0+EoI7Kgwm3ROL+O3Edx1V83B7LUHMIB4K+mWgcqTbC6+7awk5PdD073aN1Ra9wgOnr4O63ZTGBseiemb3pVKvvGMO6lultBKfGKtYW0O/UX/WfTexYlPQvxWPzD+hezIWYGUHxbiZwl684RD7QH943h/DPFqqG4be=isgznRWiGqDP91kqYRC+Y54DLxD+=z5BScD2v5CG=qEB8qiVni6Wsho2iSgOShQGerTt4b5eD9bL5DK=/A1=zZTKhx4D==',
}

headers = {
    'Accept': 'application/json, text/plain, */*',
    'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Pragma': 'no-cache',
    'Referer': 'https://ctbpsp.com/',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0',
    'sec-ch-ua': '"Microsoft Edge";v="135", "Not-A.Brand";v="8", "Chromium";v="135"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    # 'Cookie': 'Hm_lvt_b966fe201514832da03dcf6cbf25b8a2=1745654551; HMACCOUNT=F3CFAC671CCD2E41; Hm_lpvt_b966fe201514832da03dcf6cbf25b8a2=1745654567; ssxmod_itna=mqmx0DuQ9D9DzrDU7mm5YK0=D8DcnBZcAhc7lBDGTKDs7zNDSxGKidDqxBnw=v3fqel70wvFermrwx=XQiSawxq860EhFAGDB3DEx0=eHY0gxGGnxBYDQxAYDGDDP1Dj4ibDYS/ODjDytZBqtcDAQDQ4GyDitDKLiBDi3DA4DjGwwIQDt9DYQDGqDSblT4xD3Df8tqDDNqzcD4WgDDbxUll824kQWeRqqQGqDMD7tD/RqwyluwT9GVRuHGE6PcbQrDtqD9Glt08W+g4CXuA=4t8Ej54+pw0DxQWOGQrAxuBiFQmPxa+hD/vprKuP0iK+x3QGE0Gx3Y0+DxeD; ssxmod_itna2=mqmx0DuQ9D9DzrDU7mm5YK0=D8DcnBZcAhc7lBDGqikjC=DlEr4j4K+Kb=5K5+oQ2QWk5KQe+xApxPd3Wg28eYlCOTaf387o5=yff4hQp=fEQy9p7YfmDI+zFqNfcAMf+Gu86sxUmfkB0UqeW6AQT3eB+E8lwrNfoRx9ki+BGLfYbh7GwA=muu+WoIYymn1fMw7bPUPHuLut+wlt3nxrucmibFuzca5Tbo6YiLHqxQocimtwe=sg8juD32bS0L73AKmNIY1Wd=6V1vttCr6lAfz77OF=df5wxTOw5Au8SNEfuqeFk5EspK3r=n4p8iViTa3uhY0HKe4iBxvRW39bWhuiiz7n4tTqNm58bWCPwYiYuw0Qu5YRxKiHUrgzP84Fre9GzYw0cVYgOQKW8az9wQkWQaAXeI4yx5YpbCILYwFWR=HuMQKosvNQHLG9bmFWf3HkqX/qltwXiYFwSh7T5NmFCSb+eiHueOOQQwsb+F/SHY0liG348Cg0qH8m0G39mC++4o0+mWwdpjmWIBxzb5GBrzWjr0vK0QCeuCNCr8O14R=QG+arrL4xYxHpP/4foad0+EoI7Kgwm3ROL+O3Edx1V83B7LUHMIB4K+mWgcqTbC6+7awk5PdD073aN1Ra9wgOnr4O63ZTGBseiemb3pVKvvGMO6lultBKfGKtYW0O/UX/WfTexYlPQvxWPzD+hezIWYGUHxbiZwl684RD7QH943h/DPFqqG4be=isgznRWiGqDP91kqYRC+Y54DLxD+=z5BScD2v5CG=qEB8qiVni6Wsho2iSgOShQGerTt4b5eD9bL5DK=/A1=zZTKhx4D==',
}

params = {
    'keyword': '成都',
    'uid': '0',
    'PageSize': '10',
    'CurrentPage': '7',
    'searchType': '0',
    'bulletinType': '5',
    'type__1017': 'n4+x9DgGKiqGqAKKx05DK3xCqq8Q8eTtF7e4D',
}

response = requests.get('https://ctbpsp.com/cutominfoapi/searchkeyword', params=params, cookies=cookies, headers=headers)
data = response.text
print(data)
js = execjs.compile(open("zb.js",encoding="utf-8").read())
print(js)
mingwen = js.call('jiemi',data)

print(mingwen)